package DP1;

/**
 * 判断字符串是否是回文字符串
 */
public class Main13 {
    public static void main(String[] args) {
//        String s1 = "";
////        System.out.println(isPalinString(s1));
////        String s2 = "   ";
////        System.out.println(isPalinString(s2));
////        String s3 = "abcba";
////        System.out.println(isPalinString(s3));
////        String s4 = "gth";
////        System.out.println(isPalinString(s4));
        Integer a = 7;
        Integer b = 7;
        System.out.println(a==b);
    }

    public static boolean isPalinString(String s){
        if(s==null || s.length()==0) return true;
        // 双指针法
        int left = 0;
        int right = s.length()-1;
        while(left < right){
            if(s.charAt(left)!=s.charAt(right))
                return false;
            left++;
            right--;
        }
        return true;
    }
    



}
